package reduce.fz.com.reduce.util.http;


import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * dns查询超时设置
 * @auth lipf on 2015/4/26.
 */
public class DNSResolver implements Runnable {
    private String domain;
    private InetAddress inetAddress;

    public DNSResolver(String domain) {
        this.domain = domain;
    }

    public void run() {
        try {
            InetAddress addr = InetAddress.getByName(domain);
            set(addr);
        } catch (UnknownHostException e) {
        }
    }

    public synchronized void set(InetAddress inetAddress) {
        this.inetAddress = inetAddress;
    }
    public synchronized InetAddress get() {
        return inetAddress;
    }
}
